const router = require('koa-router')()
const Mock = require('mockjs')
const { banners, menus, tabs } = Mock.mock({
  "banners|4-10": [{
    "id": "@id",
    "image": "@image(375x200, @color)",
  }],
  "menus|20": [{
    "id": "@id",
    "image": "@image(50x50, @color)",
    "title": "@ctitle(4)"
  }],
  "tabs|10-20": [{
    "id": "@id",
    "title": "@ctitle(4)",
    "children|30-100": [{
      "id": "@id",
      "image": "@image(80x80, @color)",
      "title": "@ctitle(2, 4)"
    }]
  }]
})

router.get('/banners', ctx => {
  ctx.body = {
    data: banners,
    code: 200,
    message: 'ok'
  }
})

router.get('/menus', ctx => {
  ctx.body = {
    data: menus,
    code: 200,
    message: 'ok'
  }
})

router.get('/tabs', ctx => {
  ctx.body = {
    data: tabs,
    code: 200,
    message: 'ok'
  }
})


module.exports = router
